<template>
  <div class="page">
    <header title="个人简历" @click="BackToBeforePage">
      <h2>
        <i>
          <img src="/resume.svg" />简历
          <span class="BackToBeforePage">返回封面？</span>
        </i>
        <i>My Resume</i>
      </h2>
      <i class="des">
        <i>Tech Otakus Change The World</i>
        <i>本简历项目由Vue3构建</i>
      </i>
    </header>
    <div class="contain">
      <section class="left">
        <div class="introduction" title="个人简介">
          <h4>
            <span>个人简介</span>
            <i>Self Introduction</i>
          </h4>
          <h1>姓名:{{ resumeInfo.userInfo.name }}</h1>
          <p>
            性别:{{ resumeInfo.userInfo.gender }},年龄:{{ resumeInfo.userInfo.age }}，{{ resumeInfo.userInfo.post }}，<span
              class="age"
              >{{ resumeInfo.userInfo.exp }}</span
            >开发经验
          </p>
          <p>
            <img src="@/assets/logos/school.svg" style="width: 18px" />
            <span class="phone">学历:{{ resumeInfo.userInfo.record }}，毕业时间:{{ resumeInfo.userInfo.graduation }}</span>
          </p>
          <span>
            <img src="@/assets/logos/phone.svg" style="width: 18px" />
            <span class="phone">手机号(微信):{{ resumeInfo.userInfo.phone }}</span>
          </span>
          <span>
            <img src="@/assets/logos/mail.svg" style="width: 18px" />
            <a class="link">邮箱:{{ resumeInfo.userInfo.mail }}</a>
          </span>
          <div title="码云地址" class="gitee">
            <img style="width: 18px" src="@/assets/logos/gitee.svg" />
            <a
            :href="resumeInfo.network.gitee"
            class="link"
            target="_blank"
          >
            <span>码云地址：</span>
            {{ resumeInfo.network.getee }}
          </a>
          </div>
          <div class="tags">
            <span class="tag" v-for="item in resumeInfo.skill" :key="item">{{ item }}</span>&nbsp;
          </div>
        </div>
        <div class="tech" title="技术栈">
          <h4>
            <span>技术栈</span>
            <i>My Tech</i>
          </h4>
          <div ref="main" style="width: 100%; height: 400px"></div>
        </div>
        <div class="techAdv" title="技术优势">
          <h4>
            <span>技术优势</span>
            <i>Tech Advance</i>
          </h4>
          <ul class="techIntr">
            <li v-for="item in resumeInfo.techIntr" :key="item">{{ item }}</li>
          </ul>
        </div>
      </section>
      <section class="right">
        <div class="AboutMe" title="工作经历">
          <h4>
            <span>工作经历</span>
            <i>Work Experience</i>
          </h4>
          <ul class="hobby" v-for="(item,index) in resumeInfo.workExp">
            <li>单 位：{{ item.company }} {{ itemworkTime }}</li>
            <li>职 位：{{ item.position }}</li>
            <li>
              内 容：
              <p v-for="items in item.content" :key="items">{{ items }}</p>
            </li>
          </ul>
        </div>
        <div class="exp" title="项目经历">
          <h4>
            <span>项目经历</span>
            <i>Project Experience</i>
          </h4>
          <div>
            <h3>点击卡片可查看相关项目详情</h3>
            <el-timeline>
              <el-timeline-item  placement="top" :hollow="true" :color="item.color" v-for="(item,index) in resumeInfo.project">
                <el-card class="timelineItem">
                  <h4>公司名称 : {{ item.company }}</h4>
                  <p>项目名称 : {{ item.projectName }}</p>
                  <ul :class="'demo'+index">
                    <li>
                      项目描述:{{ item.projectInfo }}
                    </li>
                  </ul>
                  <div class="tags">
                    <span class="tag" v-for="items in item.tags" :key="items">{{ items }}</span>
                  </div>
                  <p>{{ time }}</p>
                  <!-- <p class="jump">点击查看项目</p> -->
                </el-card>
              </el-timeline-item>
            </el-timeline>
          </div>
        </div>
      </section>
    </div>
    <footer>
      <div class="copyright">
        <p>
          <span class="text">@Made</span> by
          <i class="mark" style="color: #fff">&nbsp; {{ resumeInfo.userInfo.ename }} &nbsp;</i>
        </p>
        <p>
          <span class="text">@Powered</span> with
          <img src="@/assets/logos/vue.svg" title="vue" class="tinyICon" />
          <img src="@/assets/logos/vite.svg" title="vite" class="tinyICon" />
          <img src="@/assets/logos/pinia.svg" title="pinia" class="tinyICon" />
          <img src="@/assets/logos/gitee.svg" title="gitee" class="tinyICon" />
          <img
            src="@/assets/logos/ts.png"
            title="TypeScript"
            class="longIcon"
          />
          <img
            src="@/assets/logos/elementPlus.svg"
            title="elementPlus"
            class="longIcon"
          />
          <img
            src="@/assets/logos/eChatrs.png"
            title="eChatrs"
            class="longIcon"
          />
        </p>
      </div>
    </footer>
  </div>
</template>

<script setup>
import * as echarts from "echarts";
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import useStore from "@/store";
import resumeData from '@/assets/info.ts'
const { methods } = useStore();
const router = useRouter();

// 使用ref创建虚拟DOM引用，使用时用main.value
const main = ref();
onMounted(() => {
  init(); // 渲染图表
  device(); // 根据设备类型选择客户端页面
});

const resumeInfo = resumeData;
const device = () => {
  // 获取设备类型
  let deviceType = ref(methods.getDeviceType());
  router.push(deviceType.value ? "/homeMobile" : "/home");

  // 根据设备类型弹出消息提示框
  if (!deviceType.value) {
    ElMessage({
      dangerousGFHUseHTMLString: true,
      message:
        '检测到PC端设备，已为PC端优化；当前页面：主页',
      type: "success",
      duration: 2500,
    });
  }
};

function init() {
  // 基于准备好的dom，初始化echarts实例
  const myChart = echarts.init(main.value);
  // 指定图表的配置项和数据
  const option = {
    title: {
      text: "Skills",
    },
    radar: {
      indicator: [
        { name: "Javascript", max: 10000 },
        { name: "Typescript", max: 10000 },
        { name: "CSS", max: 10000 },
        { name: "Vue2", max: 10000 },
        { name: "Vue3", max: 10000 },
        { name: "Axios", max: 10000 },
        { name: "Uniapp", max: 10000 },
      ],
      axisName: {
        color: "#fff",
        backgroundColor: "#666",
        borderRadius: 3,
        padding: [3, 5],
      },
      splitArea: {
        areaStyle: {
          color: ["#77EADF", "#428BD4", "#64AFE9", "#26C3BE"],
          shadowColor: "rgba(0, 0, 0, 0.2)",
          shadowBlur: 10,
        },
      },
    },
    series: [
      {
        name: "Budget vs spending",
        type: "radar",
        color: "#ff0000",
        data: [
          {
            value: [6500, 5500, 7000, 7500, 7000, 7500, 7500],
            name: "语言基础",
            areaStyle: {
              color: new echarts.graphic.RadialGradient(0.1, 0.1, 1, [
                {
                  color: "rgba(255, 145, 124, 0.1)",
                  offset: 0,
                },
                {
                  color: "rgba(255, 145, 124, 0.9)",
                  offset: 1,
                },
              ]),
            },
          },
        ],
      },
    ],
  };
  myChart.setOption(option);
}
const demoI = () => {
  // router.push("/demoI");
};

const demoII = () => {
  // router.push("/demoII");
};

const demoIII = () => {
  // router.push("/demoIII");
};

const BackToBeforePage = () => {
  router.push("/");
};
</script>

<style src="@/assets/css/home.css"></style>
<style lang="less" scoped>
@keyframes animation {
  0% {
    transform: scale(3);
    opacity: 0.1;
  }

  25% {
    transform: scale(2);
    opacity: 0.5;
  }

  50% {
    transform: scale(1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.page {
  position: relative;
  width: 1200px;
  min-height: 1700px;
  background-color: #f7f7f7;
  margin: auto;
  box-shadow: 0 0 6px #00000083;
  padding: 40px;
  margin-top: 50px;
  margin-bottom: 50px;
  animation: animation 0.7s linear alternate;

  header {
    cursor: pointer;
    margin-bottom: 30px;

    h2 {
      display: flex;
      justify-content: space-between;
      transition: all 0.3s;
      border-bottom: 3px solid #a0a0a0;
      margin: 0;

      img {
        position: relative;
        top: 4px;
        width: 25px;
        height: 25px;
      }
    }

    .BackToBeforePage {
      position: relative;
      right: 100px;
      color: #ff0000;
      opacity: 0;
      transition: all 0.3s;
    }

    &:hover {
      color: #000;

      h2 {
        border-bottom: 3px solid #000000;
      }

      .BackToBeforePage {
        right: -20px;
        opacity: 1;
      }
    }

    .des {
      display: flex;
      justify-content: space-between;
    }
  }

  .contain {
    display: flex;
    justify-content: space-between;

    .left {
      width: 580px;
      height: 1500px;

      .introduction {
        transition: all 0.3s;
        color: #000;

        h4 {
          display: flex;
          justify-content: space-between;
          border-bottom: 1px solid #a0a0a0;
          cursor: pointer;
          transition: all 0.3s;
        }

        .age {
          padding-left: 4px;
          padding-right: 4px;
          background-color: #000;
          color: #fff;
          border-radius: 7px;
          margin-right: 3px;
        }

        .phone {
          position: relative;
          bottom: 2px;
          margin-left: 5px;
          margin-right: 30px;
        }

        .link {
          position: relative;
          bottom: 2px;
          color: #26c3be;
          margin-left: 5px;
          transition: all 0.3s;
          text-decoration: none;
          cursor: pointer;

          &:hover {
            color: #9900ff;
          }
        }

        .gitee {
          margin-top: 12px;

          a {
            bottom: 3px;

            span {
              color: #000;
            }
          }
        }

        .tags {
          margin-top: 10px;
          color: #fff;

          .tag {
            display: inline-block;
            height: 25px;
            line-height: 25px;
            font-size: 15px;
            text-align: center;
            border-radius: 20px;
            border: 2px solid #797979;
            padding-left: 5px;
            padding-right: 5px;
            background-color: #000;
            cursor: pointer;
          }
        }
      }

      .tech {
        transition: all 0.3s;
        color: #000;

        h4 {
          display: flex;
          justify-content: space-between;
          border-bottom: 1px solid #a0a0a0;
          cursor: pointer;
          transition: all 0.3s;
        }
      }

      .techAdv {
        transition: all 0.3s;
        color: #000;

        h4 {
          display: flex;
          justify-content: space-between;
          border-bottom: 1px solid #a0a0a0;
          cursor: pointer;
          transition: all 0.3s;
        }

        .techIntr {
          li {
            margin-bottom: 18px;
          }
        }
      }
    }

    .right {
      width: 580px;
      min-height: 1500px;

      .AboutMe {
        transition: all 0.3s;
        color: #000;

        h4 {
          display: flex;
          justify-content: space-between;
          border-bottom: 1px solid #a0a0a0;
          cursor: pointer;
          transition: all 0.3s;
        }

        .hobby {
          li {
            margin-bottom: 18px;
          }
        }
      }

      .exp {
        transition: all 0.3s;
        color: #000;

        h3 {
          text-align: center;
          transition: all 0.3s;
        }

        h4 {
          display: flex;
          justify-content: space-between;
          border-bottom: 1px solid #a0a0a0;
          cursor: pointer;
          transition: all 0.3s;
        }

        ul.timeLine {
          width: 300px;
          height: 300px;
        }

        &:hover {
          h3 {
            color: #409EFF;
          }
        }

        .timelineItem {
          position: relative;
          cursor: pointer;

          ul {
            background-color: #fff;
            padding: 10px 0 10px 20px;
            transition: all 0.5s;

            li {
              color: #000;
              margin-bottom: 10px;
            }
          }

          .tags {
            margin-top: 10px;
            margin-left: 20px;

            .tag {
              display: inline-block;
              height: 15px;
              line-height: 15px;
              font-size: 15px;
              color: #ffffff;
              text-align: center;
              border-radius: 20px;
              border: 2px solid #797979;
              padding-left: 5px;
              padding-right: 5px;
              margin-right: 7px;
              margin-bottom: 10px;
              background-color: #495057;
            }
          }

          .jump {
            position: absolute;
            top: 50px;
            right: 80px;
            opacity: 0;
            font-size: 25px;
            border: none;
            background-color: #00000000;
            font-style: italic;
            color: #919191;
          }

          &:hover {
            background-color: rgba(0, 0, 0, 0.116);

            .demo0 {
              background-color: #1acae9;
              border-radius: 10px;

              li {
                color: #f7f7f7;
              }
            }

            .demo1 {
              background-color: #491fe2;
              border-radius: 10px;

              li {
                color: #f7f7f7;
              }
            }

            .demo2 {
              background-color: #21d921;
              border-radius: 10px;

              li {
                color: #f7f7f7;
              }
            }

            .demo3 {
              background-color: #4facfe;
              border-radius: 10px;

              li {
                color: #f7f7f7;
              }
            }

            .jump {
              opacity: 1;
            }
          }
        }
      }
    }
  }
}

footer {
  position: absolute;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;

  .copyright {
    padding: 10px;
    margin-right: 150px;
    color: #000;

    img {
      margin-right: 30px;
      cursor: pointer;
    }

    .tinyICon {
      width: 30px;
    }

    .longIcon {
      width: 100px;
    }

    .text {
      font-size: 25px;
      font-style: italic;
      margin-right: 5px;
    }

    .mark {
      font-size: 20px;
      font-style: italic;
      background: linear-gradient(90deg, #43e97b, #4facfe);
      border-radius: 5px;
    }
  }
}
</style>
